package cn.edu.scau.cmi.yangzemin.spring.client;
import org.springframework.context.ApplicationContext;
import cn.edu.scau.cmi.yangzemin.spring.domain.Student;
import cn.edu.scau.cmi.yangzemin.spring.domain.Teacher;
import cn.edu.scau.cmi.yangzemin.spring.util.ApplicationContextUtil;
public class SpringApplicationContextClient {
		public static void main(String[] args)
		{
			ApplicationContext applicationContext = getApplicationContext();
			Student student = (Student) applicationContext.getBean("zhangsan");

			Teacher teacher = (Teacher) applicationContext.getBean("liang");

			student.setTutor(teacher);

			System.out.println(student.getName() + "的毕业设计指导导师是：" + teacher.getName());
		}

		private static ApplicationContext getApplicationContext()
		{
			return ApplicationContextUtil.getInstance();
		}
}
